package com.hospes.rmes;

import android.app.Application;
import android.content.Context;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.hospes.rmes.constants.ConstMain;
import com.hospes.rmes.core.FileManager;
import com.hospes.rmes.core.ImageDownloader;
import com.hospes.rmes.core.NetworkService;
import com.hospes.rmes.managers.NewsManager;

/**
 * Created by IntelliJ IDEA.
 * User: Andrew Khloponin
 * Date: 17.06.11
 */
public class App extends Application {
	private static boolean _isInitalized = false;
	public static String DeviceId = "1";
	public static Context context = null;
	public static FileManager fileManager;
	public static NetworkService networkService;
	public static ImageDownloader imageDownloader;

	public static boolean isInitalized() {
		return _isInitalized;
	}

	@Override
	public void onCreate() {
		super.onCreate();
		initalize();
	}

	void initalize() {
		context = getApplicationContext();
		TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
		DeviceId = telephonyManager.getDeviceId();
		fileManager = new FileManager();
		networkService = new NetworkService();
		imageDownloader = new ImageDownloader(networkService);
		new NewsManager();
		_isInitalized = true;
		Log.w(ConstMain.LOG_TAG, "Application run");
	}
}
